import request from '@/utils/request'

// 查询生产领料单列表
export function listPicking(query) {
  return request({
    url: '/production/picking/list',
    method: 'get',
    params: query
  })
}

// 查询生产领料单详细
export function getPicking(pickingId) {
  return request({
    url: '/production/picking/' + pickingId,
    method: 'get'
  })
}

// 新增生产领料单
export function addPicking(data) {
  return request({
    url: '/production/picking',
    method: 'post',
    data: data
  })
}

// 修改生产领料单
export function updatePicking(data) {
  return request({
    url: '/production/picking',
    method: 'put',
    data: data
  })
}

// 删除生产领料单
export function delPicking(pickingIds) {
  return request({
    url: '/production/picking/' + pickingIds,
    method: 'delete'
  })
}

// 校验领料单编号
export function checkPickingCodeUnique(params) {
  return request({
    url: '/production/picking/checkPickingCodeUnique',
    method: 'get',
    params: params
  })
}

// 根据工单ID查询领料单列表
export function listByWorkOrderId(workOrderId) {
  return request({
    url: '/production/picking/listByWorkOrderId/' + workOrderId,
    method: 'get'
  })
}

// 审核生产领料单
export function auditPicking(pickingId, status) {
  return request({
    url: '/production/picking/audit/' + pickingId + '/' + status,
    method: 'put'
  })
}

// 执行生产领料单
export function executePicking(pickingId) {
  return request({
    url: '/production/picking/execute/' + pickingId,
    method: 'put'
  })
}